<template>
  <div id="dialogTable">
    <el-dialog :title="dialogTableObj.title" :visible.sync="dialogTableObj.dialogTableVisible">
      <slot name="searchDiv">
        <div class="searchDiv"></div>
      </slot>
      <el-table :data="dialogTableObj.tableData" ref="dialogTableTest">
        <!-- 添加时需要加入选择按钮 -->
        <el-table-column v-for="(column, key, index) in dialogTableObj.tableColumns" :key="column.id"
                         :prop="column.attributeName"
                         align="center" :label="column.title" :min-width="column.width"></el-table-column>
        <!-- 单选框 -->
        <slot></slot>
      </el-table>
      <div class="pageBar">
        <pageBar :pageObj="dialogTableObj.pageObj" v-on:changeSearchPageSize="changePageSize"
                 v-on:changeSearchPageNo="changePageNo"></pageBar>
      </div>
    </el-dialog>
  </div>
</template>

<script>
  import pageBar from '../pageBar/pageBar'
  // 页面弹窗出现信息
  export default {
    name: "dialogTable",
    components: {
      pageBar
    },
    props: [
      'dialogTableObj',
    ],
    methods: {
      changePageSize(val) {
        // 切换第几页
        this.$emit('getChildPageSize', val)
      },
      changePageNo(val) {
        // 切换每页数目
        this.$emit('getChildPageNo', val)
      }
    }
  }
</script>

<style lang="scss" type="text/scss">
  @import "dialogTable.scss";
</style>
